package com.example.user.feign;

import com.example.user.entity.User;
import com.example.user.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author heshao
 * @date 2021/1/12 11:05
 */
@RestController
public class UserClientImpl implements UserClient {

    private final UserService userService;

    public UserClientImpl(UserService userService) {
        this.userService = userService;
    }

    @Override
    @GetMapping(API_PREFIX + "/{id}")
    public User userInfo(@PathVariable Long id) {
        return userService.findById(id);
    }

}
